package com.example.voucher.contract.spi;

import java.math.BigDecimal;
import java.util.Date;

import com.example.voucher.contract.VoucherItemCapable;
import com.example.voucher.entity.InvoiceReceiptVerify;
import com.example.voucher.enums.VoucherScenarioEnum;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
public class VoucherItemCapablePurchaseInvoiceReceiptVerifyAdapter implements VoucherItemCapable {

    private InvoiceReceiptVerify irv;

    @Override
    public String getOrgTitleCode() {
        return irv.getLeCode();
    }

    @Override
    public String getOrgTitleName() {
        return irv.getLeName();
    }

    @Override
    public String getOrgTitleFullname() {
        return irv.getLeFullname();
    }

    @Override
    public String getOppoOrgTitleCode() {
        return irv.getTsTrCode();
    }

    @Override
    public String getOppoOrgTitleName() {
        return irv.getTsTrName();
    }

    @Override
    public String getOppoOrgTitleFullname() {
        return irv.getTsTrFullname();
    }

    @Override
    public String getInvoiceCode() {
        return irv.getInvoiceCode();
    }

    @Override
    public String getInvoiceNo() {
        return irv.getInvoiceNo();
    }

    @Override
    public Date getInvoiceDate() {
        return irv.getBillingDate();
    }

    @Override
    public Long getInvoiceId() {
        return irv.getInvoiceId();
    }

    @Override
    public Integer getInvoiceSn() {
        if (null != irv.getInvoiceSn()) {
            return irv.getInvoiceSn().intValue();
        }
        return null;
    }

    @Override
    public Long getInvoiceSnId() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public BigDecimal getWeight() {
        return irv.getVerifyQty();
    }

    @Override
    public BigDecimal getPreTaxAmount() {
        return irv.getVerifyPretaxAmt();
    }

    @Override
    public BigDecimal getTaxAmount() {
        return irv.getVerifyTaxAmt();
    }

    @Override
    public BigDecimal getPriceTaxAmount() {
        return irv.getVerifyAmt();
    }

    @Override
    public String getOrderCode() {
        return irv.getReceiptCode();
    }

    @Override
    public Date getOrderDate() {
        return irv.getVerifyDate();
    }

    @Override
    public String getRcCode() {
        return irv.getRcCode();
    }

    @Override
    public String getRcName() {
        return irv.getRcName();
    }

    @Override
    public String getProductLine() {
        return irv.getProductLine();
    }

    @Override
    public String getScenario() {
        // xssy && 货款，返回VoucherScenarioEnum.PurchaseInvoice_GOODS.getCode()
        // xssy && 费用，返回VoucherScenarioEnum.PurchaseInvoice_EXPENSE.getCode()
        // ygzy 返回VoucherScenarioEnum.PurchaseInvoice_GOODS.getCode()
        String scenario = irv.getInvoiceType() == 1 ? VoucherScenarioEnum.PurchaseInvoice_GOODS.getCode()
            : VoucherScenarioEnum.PurchaseInvoice_EXPENSE.getCode();
        return scenario;
    }

    @Override
    public String getSiteCode() {
        return irv.getSiteCode();
    }

    @Override
    public String getSiteName() {
        return irv.getSiteName();
    }

    @Override
    public String getSiteFullname() {
        return irv.getSiteFullname();
    }

    @Override
    public Date getScanDate() {
        return irv.getBillingDate();
    }

    @Override
    public Date getVerifyDate() {
         return irv.getVerifyDate();
    }

    @Override
    public Date getAccountDate() {
         return irv.getAccountDate();
    }

}
